/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.uoc.tfc.exuoc.controladors;

import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;

//import org.apache.log4j.Logger;
//import org.apache.log4j.PropertyConfigurator;

/**
 *
 * @author Apache Foundation
 *
 */
public class GestorLogs {
    
    //private static Logger log=null;
    private  Log log = LogFactory.getLog(GestorLogs.class);
    
   /* private void init(){
        String resource =Config.rutaLog;
        URL configFileResource =GestorLogs.class.getResource(resource);
        PropertyConfigurator.configure(configFileResource);
    }*/
    private GestorLogs() {
        
        log=LogFactory.getLog(this.getClass());
    }
    private GestorLogs(String classe){
        
        log=LogFactory.getLog(classe);
        //log= Logger.getLogger(classe);
        // Per log4j //log= Logger.getLogger(classe);
    }


    public static GestorLogs getRootLog(){
        return new GestorLogs();
    };
    public static GestorLogs getLogger(String nomClasse){
        return new GestorLogs(nomClasse);
    };

   /** printing methods:
    public void trace(Object message);
    public void debug(Object message);
    public void info(Object message);
    public void warn(Object message);
    public void error(Object message);
    public void fatal(Object message);
*/
    // generic printing method:
    /*public void log(Level l, Object message){
        log.setLevel(l);
        log.info(message);

    };*/
    public void info(String cadena) {
        log.info(cadena);
    }public void info(String cadena,String argument) {
        log.info(cadena+":"+argument);
    }
    public void error(String text){
        log.error(text);
    }
    public void error(String text, String argument){
        log.error(text+":"+argument);
    }
    public void error(String text, int argument){
        log.error(text+":"+argument);
    }
    public void error(String text, Long argument){
        log.error(text+":"+argument);
    }
    public void error(String text, String[] arguments){
        log.error(text+":"+arguments);
    }
    public void error(String text, Throwable t){
        log.error(text+":",t);
    }

    //Accions de control
    public void debug(String cadena) {
        log.debug(cadena);
    }public void debug(String cadena,String argument) {
        log.debug(cadena+": "+argument);
    }

}



